﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ExpenseSystem.Model;
using ExpenseSystem.Lor;
using ExpenseSystem.Common;
using ExpenseSystem.DataUpdater;
using ExpenseSystem.Fether;
using ExpenseSystem.Core.DataAddOn;

namespace ExpenseSystem.Core.QuoteModules
{
    public class QuoteBaseManager:QuoteManager
    {
        QuoteFetcher fetcher = new QuoteFetcher();
        public override bool Delete(QuoteModel Quote, out string message)
        {
            if (Quote.Site != profile.SiteId)
            {
                message = "当前登录的组织与档案所在组织不一致";
                return false;
            }
            bool result = QuoteUpdater.Remove(Quote, tran, fetcher, out message);
            return result;
        }

        public override bool DeleteById( long[] QuoteIds,  out string message)
        {
            bool result = true;
            result = QuoteUpdater.RemoveById( profile.SiteId, QuoteIds, tran, fetcher, out message);
            return result;
        }

        public override bool Save( QuoteModel Quote,  out string message, params IAddable<QuoteModel>[] addable)
        {
            if (Quote.Site != profile.SiteId)
            {
                message = "当前登录的组织与档案所在组织不一致";
                return false;
            }
            bool result = true;
            result = QuoteUpdater.Save( Quote, tran, fetcher, out message);
            return result;
        }
    }
}
